You are here: About>Computing & Technology>Delphi Programming
About.com Delphi Programming
How To Create the Basic Unit for a New Component

Steps to crating a new (graphics) component from TImage. Or, in other words, how to create a new component from an existing one.

Difficulty Level: easy      Time Required: 5 minutes


Here's How:
  1. Start Delphi and select File | New ...
  2. Double-click the Component icon in the Object Repository.
  3. The "New Component" dialog box is displayed.
  4. Use the drop-down list to select a base class (Ancestor type).
  5. Select TImage.
  6. Type the name of your new component's class in the Class Name field. Type TPictureClip (or some other name)
  7. Select the Component palette location in which you want to place this derived component. Select "Samples".
  8. Click on OK.
  9. The Code Editor appears and displays a new source code unit.
  10. Save the unit as PictureClip.pas.
  11. You are now ready to code you own TPictureClip component.
Tips:
    When you create a new component, you should choose a base class that most closely matches the type of component you want to create (step 4). The Unit file name field is used to specify the name of the file that will contain the component's source.

Related Features:

From Zarko Gajic,
Your Guide to Delphi Programming.
FREE Newsletter. Sign Up Now!
  All Topics | Email Article | Print this Page | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help Our Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy ©2007 About, Inc., A part of The New York Times Company. All rights reserved.